import request from '@/modules/index/utils/request';
import qs from "qs";

const store = {
    namespaced: true,
    state: {

    },
    mutations: {

    },
    actions: {
        // 帮助说明-列表
        async helpInfoList(context, params) {
            const data = await request({
                url: params ? `/helpInfo/pageList?${params}` : '/helpInfo/list',
                method: 'get'
            });
            return data;
        },
        // 帮助说明-保存
        async helpInfoSave(context, params) {
            const data = await request({
                url: '/helpInfo/save',
                method: 'post',
                data: params
            });
            return data;
        },
        // 帮助说明-编辑保存
        async helpInfoUpdate(context, params) {
            const data = await request({
                url: '/helpInfo/update',
                method: 'post',
                data: params,
            });
            return data;
        },
        // 帮助说明-批量删除
        async helpInfoBatchDelete(context, params) {
            const data = await request({
                url: `/helpInfo/deleteByIds`,
                method: 'post',
                params: params,
                paramsSerializer: params => {
                    return qs.stringify(params, { indices: false });
                }
            });
            return data;
        },
        // 帮助说明参数-列表
        async helpInfoParamList(context, params) {
            const data = await request({
                url: params ? `/helpParam/list?${params}` : '/helpParam/list',
                method: 'get'
            });
            return data;
        },
        // 帮助说明参数-保存
        async helpInfoParamSave(context, params) {
            const data = await request({
                url: '/helpParam/save',
                method: 'post',
                data: params,
            });
            return data;
        },
        // 帮助说明参数-编辑保存
        async helpInfoParamUpdate(context, params) {
            const data = await request({
                url: '/helpParam/update',
                method: 'post',
                data: params,
            });
            return data;
        },
        // 帮助说明参数-批量删除
        async helpInfoParamBatchDelete(context, params) {
            const data = await request({
                url: `/helpParam/deleteByIds`,
                method: 'post',
                params: params,
                paramsSerializer: params => {
                    return qs.stringify(params, { indices: false });
                }
            });
            return data;
        },

    }
};

export default store;
